<!DOCTYPE html>
<html>

	<head>
		<title>深圳市消消乐有害生物防治有限公司-新闻列表</title>
		<meta charset="UTF-8" />
		<script type="text/javascript" src="js/swiper.min.js"></script>
		<link rel="stylesheet" href="css/swiper.min.css" />
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/style.css" />
		<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
		<script src="js/xs.js"></script>
		<script type="text/javascript" src="js/global.js"></script>
		<script type="text/javascript" src="js/pages.js"></script>
	</head>

	<body>
		<div class="container bg-white">
			<div id="head"></div>
			<div class="banner row">
				<div>
					<img src="img/news_banner.jpg" width="100%" />
				</div>
			</div>
			<div class="row" style="margin-top: 20px;">
				<div class="col-sm-3 col-xs-12 p-0">
					<div class="card">
						<div class="cardHead">
							<div class="float-left">
								<img class="float-left" src="img/zxq3.jpg" / style="margin-top: 7px;margin-right: 3px;">
								<div class="titleIco float-left">新闻中心</div>
							</div>
						</div>
						<div class="cardBody">
							<ul id="navList" class="list-group list-group-flush p-3 text-center"></ul>
						</div>
					</div>
					<div class="card" style="margin-top: 15px;">
						<div class="cardHead">
							<div class="float-left">
								<img class="float-left" src="img/zxq3.jpg" / style="margin-top: 7px;margin-right: 3px;">
								<div class="titleIco float-left">联系我们</div>
							</div>
						</div>
					<div id="contact2" class="cardBody p-3 c666" style="background: url(img/20130530101646794679.jpg) right bottom no-repeat;min-height: 200px;line-height: 25px;">
					</div>
					</div>
				</div>

				<div class="col-sm-9 col-xs-12 p-0">

					<div class="card" style="margin-left: 20px;">
						<div class="cardHead">
							<div class="float-left">
								<img class="float-left" src="img/zxq3.jpg" / style="margin-top: 7px;margin-right: 3px;">
								<div class="titleIco float-left">新闻中心</div>
							</div>
						</div>
						<ul class="cardBody container-fluid list-group list-group-flush p-3" id="articleList"></ul>
						<div style="padding: 50px;">
							<div id="pagination"></div>
						</div>
					</div>
				</div>
				<div id="foot"></div>
			</div>

			<div class="scrollsidebar" id="scrollsidebar"></div>

		</div>

	</body>
	<script>
		var pId = getUrlParam("pId")
		var nId = getUrlParam("nId")

		var pageSize = 100;
		var pageNum = 1;

		$.ajax({
			type: "POST",
			async: false,
			url: baseURL + "lable/queryWebLableList.do",
			data: {
				pId: pId
			},
			dataType: "json",
			success: function(res) {
				res.data.forEach(item => {
					$("#navList").append(`<li class="list-group-item"><a href="./articleList.html?pId=${pId}&nId=${item.id}">${item.lableName}</a></li>`)
				})

				function getData() {
					var total = 0
					$.ajax({
						type: "POST",
						async: false,
						url: baseURL + "article/queryList.do",
						data: {
							lableId: nId ? nId : res.data[0].id,
							pageSize: pageSize,
							pageNo: pageNum
						},
						dataType: "json",
						success: function(ress) {
							if(ress.data.list.length > 0) {
								$("#articleList").html("")
								ress.data.list.forEach(items => {
									items.creatTime = format(items.creatTime)
									$("#articleList").append(`<a href="./article.html?pId=${pId}&nId=${nId}&aId=${items.id}" class="list-group-item d-flex justify-content-between"><div class="t-o w-80"><img src="img/foward.png" width="20px" height="20px"><span>${items.title}</span></div><span>${items.creatTime}</span></a>`)
								})
								total = ress.data.totalCount
							}
						}
					});
					return total
				}
				var total = getData()
			}
		});
		
		
		function add0(m){return m<10?'0'+m:m }
		function format(shijianchuo)
		{
		//shijianchuo是整数，否则要parseInt转换
		var time = new Date(shijianchuo);
		var y = time.getFullYear();
		var m = time.getMonth()+1;
		var d = time.getDate();
		var h = time.getHours();
		var mm = time.getMinutes();
		var s = time.getSeconds();
		return y+'-'+add0(m)+'-'+add0(d);
		}
	
	</script>

</html>